<% content_for :adminpage do %>
    #top-menu {display: none}
    #nav {display: none}
    #right-header {display: none}
    #weasel-coffee {display: none}
<% end %>
<% content_for :admin do %>
    <a href="/admin" class="hyperlink-detail">Trang Chủ</a>
    <a href="/admin/new_product" class="hyperlink-detail">Thêm Sản Phẩm</a>
    <form action="/admin/product_management" method="get">
      <label>
        <input type="text" placeholder="Từ khóa" name="key">
      </label>
      <label>
        <select name="type">
          <option value="">Tất cả</option>
          <option value="coffee">Cà phê</option>
          <option value="food">Đồ ăn</option>
          <option value="drink">Thức uống</option>
        </select>
      </label>
      <input type="submit" value="Tìm">
    </form>
    <div class='datagrid'>
      <form>
        <table>
          <tr>
            <th width=2%>ID</th>
            <th width=18%>Tên sp</th>
            <th width=40%>Mô tả</th>
            <th width=16%>Đường dẫn hình ảnh</th>
            <th width=10%>Loại sp</th>
            <th width=10%>Hiện trạng</th>
            <th width=5%>Giá</th>
          </tr>
          <% @product.each do |product| %>
              <tr>
                <td><a href="/admin/update_product?product_id=<%= product.id %>"><%= product.id %></a></td>
                <td><a href="/admin/update_product?product_id=<%= product.id %>"><%= product.name %></a></td>
                <td><a href="/admin/update_product?product_id=<%= product.id %>"><%= product.description %></a></td>
                <td><a href="/admin/update_product?product_id=<%= product.id %>"><%= product.image_url %></a></td>
                <td><%= product.product_type %></td>
                <% if product.available %>
                    <td>Còn hàng</td>
                <% else %>
                    <td>Hết hàng</td>
                <% end %>
                <td><%= product.orginal_price %></td>
              </tr>
          <% end %>
        </table>
      </form>
    </div>
<% end %>

